package com.car.loan.project.xr.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.Collection;
import java.util.List;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.car.loan.project.xr.mapper.LoanCarMapper;
import com.car.loan.project.xr.domain.LoanCar;
import com.car.loan.project.xr.service.ILoanCarService;

/**
 * 车辆信息Service业务层处理
 *
 * @author ruoyi
 * @date 2019-11-03
 */
@Service
public class LoanCarServiceImpl implements ILoanCarService {

    @Autowired
    private LoanCarMapper loanCarMapper;

    /**
     * 查询车辆信息
     *
     * @param id 车辆信息ID
     * @return 车辆信息
     */
    @Override
    public LoanCar selectLoanCarById(Long id) {
        return loanCarMapper.selectById(id);
    }

    /**
     * 查询车辆信息列表
     *
     * @param loanCar 车辆信息
     * @return 车辆信息
     */
    @Override
    public List<LoanCar> selectLoanCarList(LoanCar loanCar) {
        QueryWrapper<LoanCar> queryWrapper = new QueryWrapper<>(loanCar);
        return loanCarMapper.selectList(queryWrapper);
    }


    @Override
    public IPage<LoanCar> selectPage(IPage<LoanCar> page, QueryWrapper<LoanCar> queryWrapper) {
        return loanCarMapper.selectPage(page, queryWrapper);
    }

    /**
     * 新增车辆信息
     *
     * @param loanCar 车辆信息
     * @return 结果
     */
    @Override
    public int insertLoanCar(LoanCar loanCar) {

        return loanCarMapper.insert(loanCar);
    }

    /**
     * 修改车辆信息
     *
     * @param loanCar 车辆信息
     * @return 结果
     */
    @Override
    public int updateLoanCar(LoanCar loanCar) {

        return loanCarMapper.updateById(loanCar);
    }

    /**
     * 删除车辆信息对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteLoanCarByIds(Collection<Long> ids) {
        return loanCarMapper.deleteBatchIds(ids);
    }

    /**
     * 删除车辆信息信息
     *
     * @param id 车辆信息ID
     * @return 结果
     */
    @Override
    public int deleteLoanCarById(Long id) {
        return loanCarMapper.deleteById(id);
    }
}
